package com.skyon.rule.res.client;


import java.util.HashMap;

import com.caucho.hessian.client.HessianProxyFactory;
import com.skyon.rule.res.model.InputParam;
import com.skyon.rule.res.model.InputUrlAdapter;
import com.skyon.rule.res.model.OutputParam;
import com.skyon.rule.res.remoteInvoke.PlotInterface;

public class RmiClient {
	public static void main(String[] args) throws Exception {
		String url = "http://localhost:8080/SkyonRES-PlotServer/RMI/plot";
		
		HessianProxyFactory factory = new HessianProxyFactory();
		PlotInterface plotResource = (PlotInterface) factory.create(PlotInterface.class, url);
		
		InputParam inpp = new InputParam(new InputUrlAdapter("com.ccb.tfs.n2tfs/sample?return=Message"));
		
		inpp.getBeansMap().put("Message", new HashMap<String, Object>());
		inpp.getBeansMap().get("Message").put("message", "RRRRRRRRRRRRRR");
		
		OutputParam otpp = plotResource.callService(inpp);
		
		System.out.println("otpp.getPlotId() = " + otpp.getPlotId());
		System.out.println("otpp.getParamMap().get(\"message\") = " +otpp.getBeansMap().get("Message").get("message"));
		
	}
}
